import { MenuListType } from '@/type'
import { getBreadList } from '@/utils/utils'
import {defineStore} from 'pinia'

//页面配置项
export const useConfigStore = defineStore('config',{
    state:() => ({
        foldMenu:false,
        showGlobalSetting:false,
        topMenu:false,
        darkFlag:false,
        color:'',
        breadList: [] as any[]
    }),
    actions:{
        changeFold(){
            this.foldMenu = !this.foldMenu
        },
        changeGlobal(val:boolean){
            this.showGlobalSetting = val
        },
        changeTopMenu(val:boolean){
            this.topMenu = val
        },
        changeColor(val:string){
            this.color = val
        },
        changeBreadList(list:any[]){
            if(!list.length) return []
            this.breadList = getBreadList(list)
            return this.breadList
        }
    }
})